<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Jedrzej\Pimpable\PimpableTrait;
use Illuminate\Database\Eloquent\SoftDeletes;

class OtherOrder extends Model
{
    use HasFactory;
    use PimpableTrait;
    use SoftDeletes;


    public  $typeEnum = [
        'month' => '月卡会员',
        'quarter' => '季卡',
        'year' => '年卡',
        'ever' => '永久',
        'free' => '免费',
        'frees' => '免费领取',
        'memberCard' => '会员卡购买',
        'superMemberCard' => '卡密领取会员卡',
        'wechatPublicCode' => '微信公众号',
        'H5' => 'h5',
        'applet' => '小程序',
        'aliyun' => '支付宝',
        'wechat' => '微信',
        'yue' => '余额',
    ];


    /**
     * 默认排序
     */
    protected $defaultSortCriteria = ['id,desc'];

    /**
     * 可排序字段
     */
    public $sortable = [
        'created_at',
        'id',
        'user_id',
        'order_id',
        'code',
        'pay_type',
        'paid',
        'pay_price',
        'member_price',
        'trade_no',
        'channel_type',
        'vip_day',
    ];

    /**
     * 可搜索字段
     */
    public $searchable = [
        'created_at',
        'id',
        'user_id',
        'order_id',
        'code',
        'pay_type',
        'paid',
        'pay_price',
        'member_price',
        'trade_no',
        'channel_type',
        'vip_day',
        'type',
        'pay_time',
        'is_free',
        'is_permanent',
    ];
    /**
     * 会员购买记录表可批量赋值字段
     */
    protected $fillable = [
        'user_id',
        'type',
        'order_id',
        'member_type',
        'code',
        'pay_type',
        'paid',
        'pay_price',
        'member_price',
        'pay_time',
        'trade_no',
        'channel_type',
        'is_free',
        'is_permanent',
        'overdue_time',
        'vip_day',
    ];




    /**
     * 记录所属用户
     */
    public function user(){
        return $this->belongsTo(User::class,'user_id','id');
    }
    /**
     *
     */
}
